//
//  HLExtentionTools.m
//  HLFoundation
//
//  Created by hulinhu on 2018/11/5.
//  Copyright © 2018 胡林虎. All rights reserved.
//

#import "HLExtentionTools.h"

@implementation HLExtentionTools

-(void)showAlertView:(NSString *)text VC:(UIViewController *)currentVC{
    
#ifndef VDS_APP_EXTENSION
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:text message:@"这是一个弹窗" delegate:nil cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
    [alert show];
    
#else
    
    UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        NSLog(@"OK Action");
    }];
    UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
        NSLog(@"Cancel Action");
    }];
    
    UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:text message:@"这是一个弹窗" preferredStyle:UIAlertControllerStyleActionSheet];
    [alertVC addAction:okAction];
    [alertVC addAction:cancelAction];
    [currentVC presentViewController:alertVC animated:YES completion:nil];
    
#endif
    
}

-(void)hiddenAlertView {
    
    
}


-(UIWindow *)sharedApplicationView {
    
#ifndef VDS_APP_EXTENSION
    UIWindow *sView = [UIApplication sharedApplication].keyWindow;
    return sView;
#else
    UIWindow *sView = [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
    return sView;
#endif
}


@end
